package com.itheima.controller;

import com.itheima.service.RedisIncrLockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
public class RedisIncrLockController {

    @Autowired
    private RedisIncrLockService redisIncrLockService;

    @GetMapping("/incr")
    public void testRedisLock() {
//        redisIncrLockService.redisLockCD();
        redisIncrLockService.redisLockTest();
    }


    @GetMapping("/testLock")
    public void lockTest() {
//        redisIncrLockService.redisLockCD();
        redisIncrLockService.lockTest();
    }

    @GetMapping("/testRedissionLock")
    public void redissionLockTest() {
//        redisIncrLockService.redisLockCD();
        redisIncrLockService.redissionLockTest();
    }

    @GetMapping("/redissionLockTest01")
    public void redissionLockTest01() {
        redisIncrLockService.redissionLockTest01();
    }
}
